<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./lib/vue.js"></script>
  </head>
  <body>
    <div id="app">
      
      <h1>{{title}}</h1>
      {{age+1}} {{age+"岁"}} {{arr}} {{obj}}
      <p>这个人的姓名是{{obj.name}},这个人的年龄是{{obj.age}}</p>

      <p>{{obj.age>=18?"成年":"未成年"}}</p>
      <p>{{fn()}}</p>
    </div>
    <script>
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            // 专门来定义
            title: "张三",
            age: 1,
            arr: [1, 2, 3, 4],
            obj: { name: "zhangsan", age: 18 },
          };
        },
        methods: {
          // 专门用写函数
          fn() {
            console.log(this); //vm vue实例
            return "aaa";
          },
        },
      });
    </script>
  </body>
</html>
